package com.knowif.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.knowif.dao.UserEducationExperienceMapper;
import com.knowif.pojo.UserEducationExperience;
import com.knowif.pojo.UserEducationExperienceExample;

@Service
public class UserEducationExperience_service {

	@Autowired
	public UserEducationExperienceMapper userEducationExperienceMapper;

	
	/**
	 * @author: xingyao 
	 * @Description:  通过查询条件查询导师学习经历
	 * @param example
	 * @return
	 */
	public List<UserEducationExperience> selectByExample(UserEducationExperienceExample example) {
		if (example == null) {
			return null;
		}
		return userEducationExperienceMapper.selectByExample(example);
	}

	
	public List<UserEducationExperience> selectByUserInfoId(Integer tutorInfoId) {
		if(tutorInfoId == null){
			return new ArrayList<UserEducationExperience>();
		}
		UserEducationExperienceExample userEducationExperienceExample = new UserEducationExperienceExample();
		userEducationExperienceExample.createCriteria().andUserInfoIdEqualTo(tutorInfoId);
		List<UserEducationExperience> userEducationExperiences = userEducationExperienceMapper
				.selectByExample(userEducationExperienceExample);
		return userEducationExperiences;
	}
	
	public List<UserEducationExperience> selectByTutorIds(List<Integer> tutorIds) {
		if(tutorIds == null || tutorIds.isEmpty()){
			return new ArrayList<UserEducationExperience>();
		}
		UserEducationExperienceExample userEducationExperienceExample = new UserEducationExperienceExample();
		userEducationExperienceExample.createCriteria().andUserInfoIdIn(tutorIds);
		List<UserEducationExperience> educationExperiences = userEducationExperienceMapper.selectByExample(userEducationExperienceExample);
		return educationExperiences;
	}
}
